package main

import (
	"GoAdmin/controller"
	"GoAdmin/middleware"
	"github.com/gin-gonic/gin"
)

func CollectRoute(r *gin.Engine) *gin.Engine {
	//将跨域拦截器加入路由
	r.Use(middleware.CORSMiddleware())
	//注册
	r.POST("/api/auth/reigster", controller.Register)
	//登录
	r.POST("/api/auth/login", controller.Login)
	//用中间键来保护接口，进行较验
	r.GET("/api/auth/info", middleware.AuthMiddleWare(), controller.GetUserInfo)
	//上传文件
	r.POST("/uploadFile", middleware.AuthMiddleWare(), controller.UploadFile)
	return r
}
